<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<title>销售根据合同领货</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link href="${ctx }/CSS/style.css" rel="stylesheet" type="text/css">
<body>
<table width="684" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="27" colspan="6" bgcolor="#EEEEEE" class="tableBorder_gray">
    &nbsp;<span  class="word_deepgrey"> 当前位置：库存管理 </span>销售根据合同领货 &gt;&gt;&gt;</td>
  </tr>
    <tr><td valign="top" height="83">
    	<form action="${ctx }/contactAction.do" method="post">
    	<input type="hidden" name="method" value="save">
	    <table width="98%" height="112"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#F2F2F2">
	    	<tr>
	    		<td width="140">商品id</td><td width="400">商品名</td><td width="100">数量</td><td width="200">操作</td>
	    	</tr>
	    	<c:forEach items="${saleOrders }" var="order">
	    	<tr>
	    		<td>${order.goods.goodsId }</td>
	    		<td>${order.goods.goodsName }</td>
	    		<td>${order.salesNumber }</td>
	    		<td>
	    			<a href ="javascript:void(0);" class="getGoods" rel="${order.goods.goodsId }" ref="${order.salesNumber }">领取</a> 
	    		</td>
	    	</tr>
	    	</c:forEach>
		</table>
		</form>
	</td></tr>
</table>
<script type="text/javascript" src="${ctx }/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$(".getGoods").click(function() {
			var goodsid = $(this).attr("rel");
			var goodsnum = $(this).attr("ref");
			var datas = {
				"method":"getGoods",
				"goodsid":goodsid,
				"goodsnum":goodsnum
			};
			$.ajax({
				url : "${ctx }/reposityAction.do",
				data: datas,
				dataType : "json",
				success : function(data) {
					if(data.result == "false") {
						$(".getGoods").parent().html("缺货，请通知采购人员采购");
					} else {
						$(".getGoods").parent().html("成功领取");
					}
				}
			});
		});
	});
</script>
</body>
</html>
